﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Collections;

namespace Notifications.Helper
{
    class wsAPJunktionAPI
    {
        #region Properties

        private string _wsAPjunktionUrl;
        private string _ApplicationName;
        private decimal _ApplicationVersion;
        private int _Timeout;
        private NetworkCredential _nc;

        #endregion

        #region Construct

        public wsAPJunktionAPI(string wsAPjunktionUrl, string ApplicationName, decimal ApplicationVersion, int Timeout, NetworkCredential nc)
        {
            _wsAPjunktionUrl = wsAPjunktionUrl;
            _ApplicationName = ApplicationName;
            _ApplicationVersion = ApplicationVersion;
            _Timeout = Timeout;
            _nc = nc;
        }

        #endregion

        #region Public Methods

        public bool GetMessage(int _ApplicationId, int _UserId, ref ArrayList _Messages)
        {
            object[] _objMessages = null;

            return Init().GetMessage(_ApplicationId, _UserId, ref _objMessages);
            
        }

        #endregion

        #region Private Methods

        private APjunktion.Common.wsAPjunktion.APjunktionInterface Init()
        {
            APjunktion.Common.wsAPjunktion.APjunktionInterface _ws = new APjunktion.Common.wsAPjunktion.APjunktionInterface();
            _ws.Url = _wsAPjunktionUrl;
            _ws.Timeout = _Timeout;
            if (_nc == null)
            { _ws.UseDefaultCredentials = true; }
            else
            { _ws.Credentials = _nc; }
            return _ws;
        }

        #endregion
    }
}
